
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<form id="customer-details"  method="post"  >
    <input type="hidden" id="id" name="id">
    <table align="center" width="100%"  cellspacing="20" >
        <tr>
            <td>
                <label for="code">编码:</label>
                <input class="easyui-validatebox" type="text" id="code" name="code" data-options="required:true" />
            </td>
            <td>
                <label for="name">姓名:</label>
                <input class="easyui-validatebox" type="text" id="name" name="name" data-options="required:true" />
            </td>
            <td>  <label for="categoryId">分类:</label>
                <input id="categoryId" class="easyui-combobox" name="categoryId" data-options="valueField:'id',textField:'name',method:'get',url:'api/people/category',required:true" />
            </td>
        </tr>
        <tr>
            <td><label for="contact01">联系人:</label>
                <input class="easyui-validatebox" type="text" id="contact01" name="contact01" />
            </td>
            <td> <label for="qq01">QQ:</label>
                <input id="qq01" class="easyui-validatebox" type="text" name="qq01"/>
            </td>
            <td> <label for="tel01">手机:</label>
                <input id="tel01" class="easyui-validatebox" type="text" name="tel01"/>
            </td>
        </tr>
        <tr>
            <td> <label for="mobile01">电话:</label>
                <input id="mobile01" class="easyui-validatebox" type="text" name="mobile01"/>
            </td>
            <td><label for="contact02">联系人2:</label>
                <input class="easyui-validatebox" type="text" id="contact02" name="contact02" />
            </td>
            <td> <label for="qq02">QQ2:</label>
                <input id="qq02" class="easyui-validatebox" type="text" name="qq02"/>
            </td>
        </tr>
        <tr>
            <td> <label for="tel02">手机2:</label>
                <input id="tel02" class="easyui-validatebox" type="text" name="tel02"/>
            </td>
            <td><label for="mobile02">电话2:</label>
                <input class="easyui-validatebox" type="text" id="mobile02" name="mobile02" />
            </td>
            <td> <label for="address">地址:</label>
                <input id="address" class="easyui-validatebox" type="text" name="address"/>
            </td>
        </tr>

        <tr>
            <td>
                <label for="fax">传真:</label>
                <input class="easyui-validatebox" type="text" id="fax" name="fax"  />
            </td>
            <td> <label for="initPayables">应收期初余额:</label>
                <input class="easyui-validatebox" type="text" id="initPayables" name="initPayables" />
            </td>
            <td> <label for="initPayablesDt">日期:</label>
                <input class="easyui-datebox"  id="initPayablesDt" name="initPayablesDt" />
            </td>
        </tr>
        <tr>
            <td><label for="bankName">开户行:</label>
                <input id="bankName" class="easyui-validatebox" name="bankName" type="text"   />
            </td>
            <td><label for="bankAccount">开户行账号:</label>
                <input class="easyui-validatebox" type="text" id="bankAccount" name="bankAccount"  />
            </td>
            <td><label for="taxNumber">税号:</label>
                <input class="easyui-validatebox" type="text" id="taxNumber" name="taxNumber"  />
            </td>
        </tr>
        <tr>
            <td colspan="3"> <label for="addressReceipt">收货地址:</label>
                <input class="easyui-validatebox" type="text" id="addressReceipt" name="addressReceipt" style="width:88%" />
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <label for="note">备注:</label>
                <input class="easyui-validatebox" type="text" id="note" name="note" style="width:92%"  />
            </td>
        </tr>
        <tr>
            <td colspan="3" align="center">
                <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'"  onclick="editForm()">保存</a>
                <a class="easyui-linkbutton" data-options="iconCls:'icon-no'"  style="margin-left: 60px;" onclick="closeForm()">取消</a>
            </td>
        </tr>
    </table>
</form>
<script>
    $(function () {
        var customer=$("#customerId").val();
        console.log(customer);
        var jsonData=(JSON.parse(customer)) ;
        $('#customer-details').form('load',jsonData);
    })
    function closeForm(){
        $('#customerDialog').dialog('close');
    }
    function editForm(){
        $('#customer-details').form('submit',{
            url:'api/people/customer',
            onSubmit:function(){
                var isValid=$(this).form('validate');
                if(!isValid){}return isValid;
            },
            success:function(data){
                var jsonData=(JSON.parse(data)) ;
                if (jsonData.data!=null) {
                    $('#customerDialog').dialog('close');
                    $('#customerGrid').datagrid('reload');
                }else{
                    $.messager.alert('提示信息',jsonData.message, 'warning');
                }
            }
        });

    }
</script>




